//
//  ViewController.m
//  BonweBuy
//
//  Created by liuxin on 2020/2/24.
//  Copyright © 2020 liuxin. All rights reserved.
//

#import "ViewController.h"
#import "GoodsDetailVC.h"
#import "AddressListVC.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton *goodsButton = [UIButton initWithTitleStr:@"商品详情" titleColor:[UIColor blackColor] withFont:UIPFRegularFont(15)];
    [goodsButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:goodsButton];
    [goodsButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kAppWidth_6(15));
        make.right.mas_equalTo(-kAppWidth_6(15));
        make.height.mas_equalTo(kAppWidth_6(50));
        make.bottom.equalTo(self.view.mas_centerY).offset(-kAppWidth_6(10));
    }];
    
    UIButton *addressButton = [UIButton initWithTitleStr:@"收货地址" titleColor:[UIColor blackColor] withFont:UIPFRegularFont(15)];
    [addressButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:addressButton];
    [addressButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.height.equalTo(goodsButton);
        make.top.equalTo(goodsButton.mas_bottom).offset(kAppWidth_6(20));
    }];
}


-(void)buttonAction:(UIButton *)button{
    if ([button.currentTitle isEqualToString:@"商品详情"]) {
        [self.navigationController pushViewController:[GoodsDetailVC new] animated:YES];
    }else{
        [self.navigationController pushViewController:[AddressListVC new] animated:YES];
    }
}

@end
